<?php
#[登陆日志]
$sysnav = "manager";

#[判断权限]
if($_SESSION["admin"]["typer"] != "system")
{
	Error("对不起，您没有权限操作当前功能",$$mainlink."?file=index");
}

if($sysact == "delete")

{
	if($_SESSION["admin"]["typer"] != "system")
	{
		Error("对不起，您没有权限操作当前功能",$mainlink."?file=index");
	}

	$DB->qgQuery("truncate ".$prefix."admin_log");
	Error("登陆日志文件已清空",$mainlink."?file=adminlog&act=list");

}
elseif($sysact == "view")
{
	$id = intval($id);
	if(!$id)
	{
		Error("操作非法",$mainlink."?file=adminlog");
	}
	$sql = "UPDATE ".$prefix."admin_log SET state='0' WHERE id='".$id."' ";
	$DB->qgQuery($sql);

	Error("已解除当前IP地址",$mainlink."?file=adminlog&act=list");

}
else
{
	$psize = 30;
	$pageid = intval($pageid);
	$offset = $pageid>0 ? ($pageid-1)*$psize : 0;
	$page_url = $mainlink."?file=adminlog&act=list";
	$condition = "WHERE 1=1";
	$ifcheck = intval($ifcheck);
	if($state)
	{
		$page_url .= "&state=1";
		if($state)
		{
			$condition .= " AND state > 4 and logindate BETWEEN '".strtotime(date("Y-m-d 00:00:00"))."' AND '".strtotime(date("Y-m-d 23:59:59"))."'";
		}

	}

	#[计算信息数]
	$bcount = $DB->qgCount("SELECT id FROM ".$prefix."admin_log ".$condition);
	$rslist = $DB->qgGetAll("SELECT * FROM ".$prefix."admin_log ".$condition." ORDER BY logindate desc LIMIT ".$offset.",".$psize);
	$admin_log_list = array();
	foreach($rslist AS $key=>$value)
	{
		$admin_log_list[] = $value;
	}
	$pagelist = page($page_url,$bcount,$psize,$pageid);#[获取页数信息]
	$_SESSION["return_url"] = $page_url."&pageid=".$pageid;
}

Foot("adminlog.qg");
?>